﻿using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Linq;
using WJSHWebApi.DBModel;
using WJSHWebApi.InterFace;

// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860

namespace WJSHWebApi.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class Rawfoilmachine : ControllerBase
    {
        private IDBInterface iDBInterface;
        public Rawfoilmachine(IDBInterface dBInterface)
        {
            iDBInterface = dBInterface;
        }
        // GET: api/<Rawfoilmachine>
        [HttpGet]
        public IEnumerable<Rawfoilmachine_Entity> Get()
        {
            return iDBInterface.Where<Rawfoilmachine_Entity>(x => x.IsEnable == true).ToList();
        }

        [HttpGet]
        public IEnumerable<EmptyCache_Entity> GetEmpty()
        {
            return iDBInterface.Where<EmptyCache_Entity>(x => x.IsEnable == true && x.IsCreat==false && x.IsHave==true ).ToList();
        }
        [HttpGet]
        public IEnumerable<FullCache_Entity> GetFull()
        {
            return iDBInterface.Where<FullCache_Entity>(x => x.IsEnable == true && x.IsHave==false && x.IsCreat==false).ToList();
        }
    }
}
